home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3311 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Calculation in C: HELP
  5. Date: Sat, 27 Jan 96 18:38:45 GMT
  6. Organization: none
  7. Message-ID: <822767925snz@genesis.demon.co.uk>
  8. References: <4eddjd$mde@newsbf02.news.aol.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4eddjd$mde@newsbf02.news.aol.com>
  15.            queenhead@aol.com "Queenhead" writes:
  16.  
  17. >Hi. I am trying to use the following calculation in a program and it is
  18. >not coming out right:
  19. >
  20. >nextyr  = rate  *  currentyr  *  ( 1 - (currentyr/1000000)
  21. >
  22. >Is something wrong with that (in terms of C syntax)?  I should be getting
  23. >234,000   if rate is 2.6 and currentyr is 100,000. My program is not
  24. >giving me that.
  25.  
  26. What *is* it giving you?
  27.  
  28. What are the types of your variables? If currentyr is a long then
  29. currentyr/1000000 is 0. If currentyr is an int it may not even be able
  30. to hold 100000.
  31.  
  32. Please post the actual code you compiled - as it stands what you have here
  33. won't compile because the parentheses aren't balanced.
  34.  
  35. -- 
  36. -----------------------------------------
  37. Lawrence Kirby | fred@genesis.demon.co.uk
  38. Wilts, England | 70734.126@compuserve.com
  39. -----------------------------------------
  40.